<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.ajax4jsf.org/rich" xml:lang="en">
<head>
<title>office信息添加</title>
<meta http-equiv="keywords" content="enter,your,keywords,here" />
<meta http-equiv="description"
	content="A short description of this page." />
<link href="#{facesContext.externalContext.requestContextPath}/css/public.css" rel="stylesheet" type="text/css"
	media="screen" />
<link href="#{facesContext.externalContext.requestContextPath}/css/main.css" rel="stylesheet" type="text/css"
	media="screen" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<!-- rich:message style-->
<style type="text/css">
	.rich-message-label{
		color:red;
	}
</style>
<script type="text/javascript"><!--		
//<![CDATA[  
           
    function testCheck()
     {
        var flag = false;
         //对电子邮件的验证
        var E_mailReg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
        var PhoneReg=/^[0-9]{3,4}\-[0-9]{7,8}$/;
        var E_mail = document.getElementById("j_id2:email");
        var Phone = document.getElementById("j_id2:phone");
		if(E_mail.value != "" && Phone.value!=""){
			document.getElementById("phone_td2").style.display = "none";
			document.getElementById("email_td2").style.display = "none";
	         if(!PhoneReg.test(Phone.value)&&!E_mailReg.test(E_mail.value)){
	        	  	document.getElementById("phone_td1").style.display = "block";
	        	  	document.getElementById("email_td1").style.display = 'block';
		        	flag = false;
		      }else{
				  document.getElementById("phone_td1").style.display = "none";
				  document.getElementById("email_td1").style.display = 'none';
				  flag = true;
				}
		      return flag;
		}
		if(E_mail.value == "" && Phone.value!=""){
			document.getElementById("email_td2").style.display = "block";
			document.getElementById("phone_td2").style.display = "none";
         if(!PhoneReg.test(Phone.value)){
        	 document.getElementById("phone_td1").style.display = "block";
        	 document.getElementById("email_td1").style.display = "none";
        	 Phone.focus();
        	 flag = false;
          }else{
        	  document.getElementById("phone_td1").style.display = "none";
        	  flag = true;
          }
		}
		if(E_mail.value != "" && Phone.value == ""){
			document.getElementById("email_td2").style.display = 'none';
			document.getElementById("phone_td2").style.display = 'block';
         if(!E_mailReg.test(E_mail.value)){
        	 document.getElementById("email_td1").style.display = 'block';
        	 document.getElementById("phone_td1").style.display = 'none';
        	 E_mail.focus();
        	 flag = false;
          }else{
        	  document.getElementById("email_td1").style.display = 'none';
        	  flag = true;
          }
		}
		return flag;
      }
           
    function PhoneCheck(obj) {
    	var PhoneReg=/^[0-9]{3,4}\-[0-9]{7,8}$/
       	if(obj.value != ""){
       		document.getElementById("email_td2").style.display = 'block';
			document.getElementById("phone_td2").style.display = 'none';
	         if(!PhoneReg.test(obj.value)){
	        	 document.getElementById("phone_td1").style.display = 'block';
	        	 document.getElementById("email_td1").style.display = 'none';
	        	 obj.focus();
	        	 return false;
	          }else
	          {
	        	  document.getElementById("phone_td1").style.display = 'none';
	        	  return true;
		      }
        }else{
        	 document.getElementById("phone_td1").style.display = 'none';
       	  	 return true;
            }
    }

    function E_mailCheck(obj) {
    	var E_mailReg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/
       	if(obj.value != ""){
       		document.getElementById("email_td2").style.display = 'none';
			document.getElementById("phone_td2").style.display = 'block';
	         if(!E_mailReg.test(obj.value)){
		        
	        	 document.getElementById("phone_td1").style.display = 'none';
	        	 document.getElementById("email_td1").style.display = 'block';
	        	 obj.focus();
	        	 return false;
	          }else
	          {
	        	  document.getElementById("email_td1").style.display = 'none';
	        	  return true;
		      }
        }else{
        	document.getElementById("email_td1").style.display = 'none';
      	  	return true;
        }
    }
   
           
//]]>
--></script>

</head>
<body style="background-color: #ffffff">
<h:form>
	<div id="right">
	<div id="msgid" class="error pt10p bcf c0 tal" style="display:">
		<a4j:outputPanel  id="msgPaneladd">
		<center>
			<h:outputText styleClass="cff" value="#{OfficeinfBB.msg}" />
		</center>
	</a4j:outputPanel>
	</div>
	<div class="tablelist">
	<table  width="100%" border="1" cellpadding="0" cellspacing="0"
		bordercolor="#c3c3c3" style="border-collapse: collapse">
		<tr>
			<td>
			<h:inputHidden value="#{OfficeinfBB.officeInf.office_code}" />
			<span class="cff">*</span>分类名称
			<h:inputText id="tp_classname" class="style_input" value="#{OfficeinfBB.officeInf.office_name}" required="true">
				<f:validateLength maximum="50" />
				<rich:ajaxValidator event="onblur"/>
			</h:inputText>
			</td>
			<td>父类名称<h:selectOneMenu
							class="style_input" value="#{OfficeinfBB.officeInf.office_super}" >
							<f:selectItem />
							<f:selectItems value="#{otherParamBB.selectItems_officeInfId}" />
						</h:selectOneMenu></td>
		</tr>
		<tr>
			<td><rich:message for="tp_classname" showSummary="true" showDetail="false" /></td>
			<td></td>
		</tr>
		<tr>
			<td>固定电话<h:inputText id="phone" class="style_input" value="#{OfficeinfBB.officeInf.phone}" onblur="return PhoneCheck(this)" >
				<f:validateLength maximum="50" />
				<rich:ajaxValidator event="onblur"/>
			</h:inputText>
			</td>
			<td>邮件<h:inputText id="email" class="style_input" value="#{OfficeinfBB.officeInf.email}" onblur="return E_mailCheck(this)">
				<f:validateLength maximum="50" />
				<rich:ajaxValidator event="onblur"/>
			</h:inputText>
			</td>
		</tr>
		<tr>
			<td id="phone_td1" style="display:none" ><h:outputLabel id="phone_msg" style="color:red" value="固定电话格式不正确！" for="" /></td>
			<td id="phone_td2"><rich:message for="phone" showSummary="true" showDetail="false" /></td>
			<td id="email_td2"><rich:message for="email" showSummary="true" showDetail="false" /></td>
			<td id="email_td1" style="display:none"><h:outputLabel id="email_msg" style="color:red" value="电子邮件格式不正确！" for="" /></td>
		</tr>
		<tr>
			<td>传真
			<h:inputText id="fax" class="style_input" value="#{OfficeinfBB.officeInf.fax}" >
				<f:validateLength maximum="50" />
				<rich:ajaxValidator event="onblur"/>
			</h:inputText>
			</td>
			<td>邮编<h:inputText id="postalCode" maxlength="6" class="style_input" value="#{OfficeinfBB.officeInf.postalCode}" onkeyup="value=value.replace(/[^\Z0-9]/g,'')">
				<f:validateLength maximum="6" />
				<rich:ajaxValidator event="onblur"/>
			</h:inputText>
			</td>
		</tr>
		<tr>
			<td><rich:message for="fax" showSummary="true" showDetail="false" /></td>
			<td><rich:message for="postalCode" showSummary="true" showDetail="false" /></td>
		</tr>
		<tr>
			<td>IATACODE
				<h:inputText id="iataCode" class="style_input" value="#{OfficeinfBB.officeInf.iataCode}" >
					<f:validateLength maximum="50" />
					<rich:ajaxValidator event="onblur"/>
				</h:inputText>
			</td>
			<td>应用系统名称
				<h:inputText id="sys_id" class="style_input" value="#{OfficeinfBB.officeInf.sys_id}" >
					<f:validateLength maximum="50" />
					<rich:ajaxValidator event="onblur"/>
				</h:inputText>
			</td>
		</tr>
		<tr>
			<td><rich:message for="iataCode" showSummary="true" showDetail="false" /></td>
			<td><rich:message for="sys_id" showSummary="true" showDetail="false" /></td>
		</tr>
		<tr>
			<td colspan="2">地址<label>
			<h:inputTextarea id="office_address" value="#{OfficeinfBB.officeInf.office_address}" class="style_textarea" >
				<f:validateLength maximum="200" />
				<rich:ajaxValidator event="onblur" />
			</h:inputTextarea> </label></td>
		</tr>
		<tr>
			<td colspan="2"><rich:message for="office_address" showSummary="true" showDetail="false" /></td>
		</tr>
		<tr>
			<td colspan="2">描述<label>
			<h:inputTextarea id="descri" value="#{OfficeinfBB.officeInf.descri}" class="style_textarea" >
				<f:validateLength maximum="200" />
				<rich:ajaxValidator event="onblur" />
			</h:inputTextarea> </label></td>
		</tr>
		<tr>
			<td colspan="2"><rich:message for="descri" showSummary="true" showDetail="false" /></td>
		</tr>
		<tr>
			<td colspan="2">备注 <label> <h:inputTextarea id="remark"
				value="#{OfficeinfBB.officeInf.remark}" class="style_textarea" >
				<f:validateLength maximum="200" />
				<rich:ajaxValidator event="onblur" />
				</h:inputTextarea> </label></td>
		</tr>
		<tr>
			<td colspan="2"><rich:message for="remark" showSummary="true" showDetail="false" /></td>
		</tr>
	</table>
	</div>
	<div class="listbut" >
		<h:commandButton styleClass="buttonbg" value="保存" action="#{OfficeinfBB.updateEntityOfficeInf}" reRender="msgPaneladd"/> 
		<h:commandButton styleClass="buttonbg" value="返回" action="#{OfficeinfBB.toBack}" immediate="true"/>
    </div>
	</div>
</h:form>
</body>
</html>